import React from 'react';
import {ComboBox, GlobalProvider} from 'jh-lib';

const compData = [
    {code: '1', name: 'name1'},
    {code: '2', name: 'name2'},
]

export default class Test extends React.Component {

    state = {
        value: '2'
    };

    render() {
        return (
            <GlobalProvider>
                <ComboBox
                    compData={compData}
                    compLabel='枚举下拉框'
                    onDataLoad={() => {
                    }}
                    onChange={(value) => {
                        this.setState({
                            value
                        })
                    }}
                    value={this.state.value}
                    showSearch={true}
                    allowClear={true}
                />
                <ComboBox
                    compData={compData}
                    compLabel='枚举（禁用）'
                    onDataLoad={() => {
                    }}
                    onChange={(value) => {
                        this.setState({
                            value
                        })
                    }}
                    value={this.state.value}
                    showSearch={true}
                    allowClear={true}
                    disabled={true}
                />
                <ComboBox
                    compData={compData}
                    compLabel='枚举（禁用）'
                    onDataLoad={() => {
                    }}
                    onChange={(value) => {
                        this.setState({
                            value
                        })
                    }}
                    value={this.state.value}
                    showSearch={true}
                    allowClear={true}
                    readonly={true}
                />
            </GlobalProvider>
        )
    }
}